use strict;
use warnings;

my $simConfigFile = "sim.config";

# Parse sim config file
open FILE, $simConfigFile
    or die "Can't open simulation config file $simConfigFile\n";

my %config;
my $line = 1;
foreach (<FILE>) {
    next if /^\s*#/;
    if(/^\s*(\w+)=(\w+)/) {
        $config{$1} = $2;
    }
    else {
        print "Error format in $simConfigFile line:$line\n";
    }
    $line++;
}

close FILE;

# Setup environment
open FILE, ">tmp"
    or die "Can't open file ./tmp";

print FILE "export $_=$config{$_}\n"
    foreach (keys(%config));

close FILE;
